﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<AliyunMobileTestPlatform.Models.ProjectModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	覆盖率查看
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        SelectNav(2);
    </script>
    <script type="text/javascript">
        function createTable(data) {
            document.getElementById('appcontainer').innerHTML = data;
            onAjaxSended();
            $('#collapseOne').collapse('show');
        }
        function onAppListClick(EncodedRepositoryString,project,branch) {
            document.getElementById("chartcontainer").innerHTML = "";
            document.getElementById("path").innerHTML = "（项目路径：" + project + "/" + branch + "）";
            onAjaxPreSend();
            $.get("GetApps/" + EncodedRepositoryString, createTable)
        }
        function onAppCoverageClick(EncodedAppString) {
            onAjaxPreSend();
            $.get("GetCoverage/" + EncodedAppString, onAjaxSended);
            $('#collapseOne').collapse('hide');
        }
        function onAjaxPreSend() {
            $('#overlayer').show();
            $('#loadlayer').show();
        }
        function onAjaxSended() {
            $('#loadlayer').hide();
            $('#overlayer').hide();
        }
        function getTags(EncodedRepositoryString, pName, bName, obj) {
            if (obj.children('li').length == 3) {
                $(".tagloading").show();
                $.get("GetTags/" + EncodedRepositoryString + "/" + pName + "/" + bName, function (data) { obj.find("li.disabled").removeClass("disabled"); obj.append(data); $(".tagloading").hide(); });
            }
            else {
                $(".tagloading").hide();
                obj.find("li.disabled").removeClass("disabled");
             }
        }
        function getHistory(appName) {
            onAjaxPreSend();
            $.get("GetHistory/" + appName, onAjaxSended);
            $('#collapseOne').collapse('hide');
        }

    </script>
    <%--对原生container-fluid样式略作调整--%>
    <div class="container-fluid" style="padding-left:0">
      <div class="row-fluid">
        <div class="span3">
          <div class="well sidebar-nav">
            <ul class="nav nav-list">
            <%foreach (var item in Model)
              { %>
              <li class="dropdown">
                      <a id="<%:item.ProjectName %>" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"><%:item.ProjectName %><b class="caret"></b></a>
                      <ul class="dropdown-menu" role="menu" aria-labelledby="<%:item.ProjectName %>">
                      <%if (item.Branches.Count == 0)
                        { %>
                        <li class="disabled"><a tabindex="-1" href="#">empty</a></li>
                      <%} %>
                      <%foreach (var b in item.Branches)
                        { %>
                        <li class="dropdown-submenu">
                            <a role="menuitem" tabindex="-1" href="#" onmouseover="getTags('<%:b.EncodedRepositoryString %>','<%:item.ProjectName %>','<%:b.Name %>',$(this).next('ul'))"><%:b.Name %></a>
                            <ul class="dropdown-menu">                 
                                <li class="disabled"><a role="menuitem" tabindex="-1" href="#" onclick="onAppListClick('<%:b.EncodedRepositoryString %>','<%:item.ProjectName %>','<%:b.Name %>')"><%:b.Name %>主干</a></li>
                                <li class="divider"></li>
                                <li class="tagloading"><img src="../../Images/loading_small.gif"/></li>
                            </ul>
                        </li>
                      <%} %>
                      </ul>
               </li>
               <%} %>
            </ul>
          </div><!--/.well -->
        </div><!--/span-->
        <div class="span9">
            <div class="accordion" id="appList">
              <div class="accordion-group">
                <div class="accordion-heading">
                  <a class="accordion-toggle" data-toggle="collapse" data-parent="#appList" href="#collapseOne">
                    应用列表                  <span id="path"></span>
                  </a>
                </div>
                <div id="collapseOne" class="accordion-body collapse">
                 <div class="accordion-inner">
                    <div id="appcontainer"></div>
                  </div>
                </div>
              </div>
            </div>            
            <div id="chartcontainer">
            </div>
        </div>
      </div>
    </div>
    <div id="loadlayer">  
        <div id="loadbox">
            <img src="../../Images/loading_large.gif" width="124px" height="124px"/>
        </div>           
    </div>
     <div id="overlayer">
     </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ImportContent" runat="server">
    <link href="../../Content/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/CustomContainer.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/HighCharts/highcharts.js" type="text/javascript"></script>
    <script src="../../Scripts/HighCharts/modules/exporting.js" type="text/javascript"></script>
</asp:Content>
